<template>
	<view class="box">
		<view class="inp">
	{{$t('idSafe.changeLoginP.originalP')}}:	<input type="password" v-model="Ppass" :placeholder="$t('idSafe.changeLoginP.inpOriginalP')">
		</view>
		<view class="inps">
			{{$t('idSafe.changeLoginP.newP')}}:	<input type="password" v-model="newPass1" :placeholder="$t('idSafe.changeLoginP.inpNewP')">
		</view>
		<view class="inps">
			{{$t('idSafe.changeLoginP.sureNewP')}}:	<input type="password" v-model="newPass2" :placeholder="$t('idSafe.changeLoginP.inpSureNewP')">
		</view>
		<button type="default" @click="changePass">{{$t('idSafe.changeLoginP.sure')}}</button>
	</view>
</template>

<script>
	import api from '../../common/api.js'
	export default {
		data() {
			return {
				Ppass:'',
				newPass1:'',
				newPass2:'',
				
			}
		},
		methods: {
			changePass(){
				console.log(this.Ppass);
				console.log(this.newPass2);
					if(this.Ppass&&this.newPass1&&this.newPass2){
						console.log(111);
						
							if(this.newPass1==this.newPass2){
								this.$api.sendRequest({
										url: api.CHANGEPwd,
										data: {
											newpassword:this.newPass1,
											oldpassword:this.Ppass,
										},
										success: res2 => {
											console.log(res2);
											uni.showToast({
												title:res2.msg,
												icon:'none'
											})
										}
									});
								
							}
					
					}else{
						uni.showToast({
							title:'请补充完整信息！',
							icon:'none'
						})
					}

				
			}
		}
	}
</script>
<style>
	page{
		background-color: #F3F3F3;
	}
</style>
<style scoped>
	.box{
		height: 100vh;
		background-color: #F3F3F3;
		font-size: 1.2em;
		position: relative;
	}
.inp{
	width: 94.6%;
	height: 100rpx;
	display: flex;
	background-color: #FFFFFF;
	line-height:100rpx;
	margin-bottom: 40rpx;
	padding-left: 40rpx;
}
.inps{
	width: 94.6%;
	height: 100rpx;
	display: flex;
	padding-left: 40rpx;
	background-color: #FFFFFF;
	line-height: 100rpx;
	margin-bottom: 4rpx;
	font-size: .8em;
}
input{
	width: 400rpx;
	height: 100rpx;
	padding-left: 40rpx;
	color: #000000;
}
button{
	width: 90%;
	margin: auto;
	position: absolute;
	background-color: #006bef;
	color: #FFFFFF;
	bottom: 5vh;
	left: calc(50% - 45%);
	}
</style>
